package com.orangelife.mobile.main.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.common.activity.OrangeLifeBaseActivity;
import com.orangelife.mobile.web.WebWin;

public class UpdateShow extends OrangeLifeBaseActivity {
	WebView wwDesc;
	String url;
   @Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_ad_show);
	getUpdateIntent();
	initView();
}

private void getUpdateIntent() {
	 url = getIntent().getExtras().getString("url");
}

private void initView() {
	wwDesc = (WebWin) findViewById(R.id.wvDesc);
	wwDesc.loadUrl(url);
	wwDesc.setWebViewClient(new WebViewClient(){
		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			 if(url.endsWith(".apk")){
                 Uri uri = Uri.parse(url);
                 Intent viewIntent = new Intent(Intent.ACTION_VIEW,uri);
                 viewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                 viewIntent.setDataAndType(Uri.parse("file://" + apkfile.toString()),
//         				"application/vnd.android.package-archive");
                 UpdateShow.this.startActivity(viewIntent);
                 return true;
             }
			 return true;
		}
	});
}
 
   
}
